import request from "./request.js"

//判断邮箱是否已经存在
export function isExistEmail(email){
	return request({
		url: '/email',
		method: 'GET',
		params: { email }
	})
}

// 发送邮箱
export function sendEmail(email){
	return request({
		url: '/email',
		method: 'POST',
		async: false, // false表示同步请求，true表示异步请求
		params: { email }
	})
}

//判断用户名是否已经注册
export function isExistUser(username){
	return request({
		url: '/user/exist',
		method: 'GET',
		params: { username }
	})
}

/* 注册用户 */
export function register(registerForm){
	return request({
		url: '/register',
		method: 'POST',
		data: { ...registerForm }
	})
}

// 用户登录
export function login(loginForm){
	return request({
		url: '/login',
		method: 'POST',
		data: { ...loginForm }
	})
}

